<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
</head>
<body>
<button id="btn1">发送json数据</button>
<button id="btn2">接受json数据</button>

<script>
    $('#btn1').click(function () {
        $.ajax({
            url: "/json/send",
            type: "post",
            data: '{"username":"zs","password":123}',
            contentType: "application/json"
        })
    });

    $('#btn2').click(function () {
        $.ajax({
            url: "/json/receive",
            type: "get",
            success: function (data) {
                console.log(data)
            }
        })
    });

</script>

</body>

</html>